//
//  DWListVc.swift
//  GjCup
//
//  Created by abc on 2024/4/7.
//

import UIKit

class DWListVc: UIViewController {
    
    @IBOutlet weak var tView: UITableView!
    
    let titles = ["温度","长度","面积","体积","质量","压强","功率","功能/热"]
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    

    
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
        if segue.identifier == "DWLTD" {
            let vc = segue.destination as! DWDVc
            let index = tView.indexPathForSelectedRow?.row ?? 0
            vc.type = DWType(rawValue: index) ?? .wd
            
        }
    }
    

}
extension DWListVc: UITableViewDelegate, UITableViewDataSource{
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "DWListCell", for: indexPath) as! DWListCell
        cell.tLab.text = titles[indexPath.row]
        return cell
        
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 8
    }
}
